package com.autonomous_printer.mapper;

import com.autonomous_printer.pojo.File;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface FileMapper {


    @Select("select * from file where id=#{id}")
    public File queryFileById(@Param("id") int id);

    @Select("select * from file order by id desc")
    public List<File> queryAllFiles();

    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert("insert into file(file_name,file_lie,datetime) value (#{fileName},#{fileLie},#{datetime})")
    public int insertFile(File file);

}
